package asf.sections
{
	import asf.core.Application;
	
	dynamic internal class SectionPositioning
	{
		private var node:XMLList;
		private var app:Application;
		
		public function SectionPositioning( p_node:XMLList, p_app:Application )
		{
			node = p_node;
			app = p_app;
		}
		
		public function get margin_left( ):Number
		{
			var v:String = node.margin_left || node.@margin_left;
			return Number( app.getParsedValueOf( v ) );
		}
		
		public function get margin_right( ):Number
		{
			var v:String = node.margin_right || node.@margin_right;
			return Number( app.getParsedValueOf( v ) );
		}
		
		public function get margin_top( ):Number
		{
			var v:String = node.margin_top || node.@margin_top;
			return Number( app.getParsedValueOf( v ) );
		}
		
		public function get margin_bottom( ):Number
		{
			var v:String = node.margin_bottom || node.@margin_bottom;
			return Number( app.getParsedValueOf( v ) );
		}
		
		public function hasForceDimensions( ):Boolean
		{
			return node.hasOwnProperty( "forcedimensions_wh" ) || node.attributes( ).hasOwnProperty( "forcedimensions_wh" );
		}
		
		public function get forceDimensions( ):String
		{
			var v:String = node.forcedimensions_wh || node.@forcedimensions_wh;
			return app.getParsedValueOf( v );
		}
		
		public function forceWidthValue( ):Number
		{
			return Number( forceDimensions.split( "," )[ 0 ] );
		}
		
		public function forceHeightValue( ):Number
		{
			return Number( forceDimensions.split( "," )[ 1 ] );
		}
		
		public function get width( ):Number
		{
			return forceWidthValue( );
		}
		
		public function get height( ):Number
		{
			return forceHeightValue( );
		}
	}
}